package com.example.lenovo.demo.presenter;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;

import com.example.lenovo.demo.model.databean.StrategyBean;
import com.example.lenovo.demo.presenter.adapter.StrategyChildRvAdapter;
import com.example.lenovo.demo.view.ifgview.IStrateChildFragment;

/**
 * Created by Lenovo on 2017/1/15.
 */

public class StrategyChildFgPresenter implements IStrateChildFragment {

    private RecyclerView recyclerView;
    private Context context;
    private StrategyBean.PagesBean pagesBean;
    private StrategyChildRvAdapter adapter;

    public void initData(){
        adapter=new StrategyChildRvAdapter(pagesBean.getChildren(),context);
        LinearLayoutManager manager=new LinearLayoutManager(context,LinearLayoutManager.VERTICAL,false);
        manager.setAutoMeasureEnabled(true);
        recyclerView.setLayoutManager(manager);
        recyclerView.setAdapter(adapter);
    }

    @Override
    public void sendView(RecyclerView recyclerView, Context context, StrategyBean.PagesBean pagesBean) {
        this.context=context;
        this.pagesBean=pagesBean;
        this.recyclerView=recyclerView;
    }
}
